
[dbo].[OpportunityCompetitor]
CREATE TABLE [dbo].[OpportunityCompetitor]
(
[OpportunityCompetitorKey] [uniqueidentifier] NOT NULL CONSTRAINT [DF_OpportunityCompetitor_OpportunityCompetitorKey] DEFAULT (newid()),
[OpportunityKey] [uniqueidentifier] NOT NULL,
[CompetitorContactKey] [uniqueidentifier] NULL,
[DemoGivenFlag] [bit] NOT NULL CONSTRAINT [DF_OpportunityCompetitor_DemoGivenFlag] DEFAULT ((0)),
[CompetitorWonOpportunityFlag] [bit] NOT NULL CONSTRAINT [DF_OpportunityCompetitor_CompetitorWonOpportunityFlag] DEFAULT ((0)),
[Notes] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CreatedByUserKey] [uniqueidentifier] NOT NULL,
[CreatedOn] [datetime] NOT NULL,
[UpdatedByUserKey] [uniqueidentifier] NOT NULL,
[UpdatedOn] [datetime] NOT NULL,
[MarkedForDeleteOn] [datetime] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[OpportunityCompetitor] ADD CONSTRAINT [PK_OpportunityCompetitor] PRIMARY KEY CLUSTERED ([OpportunityCompetitorKey]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_OpportunityCompetitor_CompetitorKey] ON [dbo].[OpportunityCompetitor] ([CompetitorContactKey]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_OpportunityCompetitor_CreatedByUserKey] ON [dbo].[OpportunityCompetitor] ([CreatedByUserKey]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_OpportunityCompetitor_OpportunityKey] ON [dbo].[OpportunityCompetitor] ([OpportunityKey]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_OpportunityCompetitor_UpdatedByUserKey] ON [dbo].[OpportunityCompetitor] ([UpdatedByUserKey]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OpportunityCompetitor] ADD CONSTRAINT [FK_OpportunityCompetitor_OpportunityMain] FOREIGN KEY ([OpportunityKey]) REFERENCES [dbo].[OpportunityMain] ([OpportunityKey])
GO
ALTER TABLE [dbo].[OpportunityCompetitor] ADD CONSTRAINT [FK_OpportunityCompetitor_UserMain_CreatedBy] FOREIGN KEY ([CreatedByUserKey]) REFERENCES [dbo].[UserMain] ([UserKey])
GO
ALTER TABLE [dbo].[OpportunityCompetitor] ADD CONSTRAINT [FK_OpportunityCompetitor_UserMain_UpdatedBy] FOREIGN KEY ([UpdatedByUserKey]) REFERENCES [dbo].[UserMain] ([UserKey])
GO